<template>
  <div>
    <div class="baisc-form-custom-header">
      <a-page-header @back="() => $router.push({'path':roleListUrl})" title="角色详情" subTitle="角色信息"></a-page-header>
    </div>
    <a-card :bordered="false" title="基本信息">
      <role-form :role-id="roleId"></role-form>
    </a-card>
    <a-card :bordered="false" class="marginTop20" title="角色用户/部门" v-if="roleId">
      <role-user-group :role-id="roleId"></role-user-group>
    </a-card>
    <a-card :bordered="false" class="marginTop20" title="角色权限" v-if="roleId">
      <qc-link slot="extra" @click="saveRoleAuthority">保存权限</qc-link>
      <role-authority :role-id="roleId" ref="roleAuthority"></role-authority>
    </a-card>
  </div>
</template>
<script>
import { roleListUrl } from "@/api/org/role";
import RoleForm from "@/views/org/role/component/roleForm";
import RoleUserGroup from "@/views/org/role/component/roleUserGroup";
import RoleAuthority from "@/views/org/role/component/roleAuthority";
export default {
  components: { RoleForm, RoleUserGroup, RoleAuthority },
  data() {
    return {
      roleListUrl,
      roleId: this.$route.params.id
    };
  },
  methods: {
    saveRoleAuthority() {
      this.$refs.roleAuthority.saveRoleAuthority();
    }
  }
};
</script>
